/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.emex.app.shared.data.enums;

import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author Sergey Karavaev
 */
public enum OrderPositionStatus {

    IN_PROGRESS(0),
    RECEIVED(1),
    DECLINED(2),
    ISSUED(3),
    RETURNED_SKLAD(4),
    RETURNED_SUPPLIER(5);

    private int statusNo;

    private static Map<Integer, OrderPositionStatus> map
            = new HashMap<Integer, OrderPositionStatus>();

    static {
        for (OrderPositionStatus ord : OrderPositionStatus.values()) {
            map.put(ord.statusNo, ord);
        }
    }

    private OrderPositionStatus(final int no) {
        statusNo = no;
    }
    
    public static OrderPositionStatus valueOf(int no) {
        return map.get(no);
    }

    @Override
    public String toString() {
        switch (this) {
            case IN_PROGRESS:
                return "В работе";
            case RECEIVED:
                return "Пришло";
            case DECLINED:
                return "Отказ";
            case ISSUED:
                return "Выдано";
            case RETURNED_SKLAD:
                return "Возврат на склад";
            case RETURNED_SUPPLIER:
                return "Возврат поставщику";
            default:
                return "";
        }
    }
}
